Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
eslint-plugin-mocha
Advanced tools
eslint-plugin-mocha is an ESLint plugin that provides linting rules specific to Mocha, a popular JavaScript test framework. It helps enforce best practices and coding standards for Mocha tests, ensuring consistency and reducing common errors.
Disallow exclusive tests
This rule disallows the use of exclusive tests (e.g., `describe.only` and `it.only`) to prevent accidentally skipping other tests.
module.exports = { "rules": { "mocha/no-exclusive-tests": "error" } };
Disallow skipped tests
This rule warns against the use of skipped tests (e.g., `describe.skip` and `it.skip`) to ensure that all tests are being run.
module.exports = { "rules": { "mocha/no-skipped-tests": "warn" } };
Enforce test case titles
This rule enforces that test cases have valid descriptions, ensuring that test titles are meaningful and descriptive.
module.exports = { "rules": { "mocha/valid-test-description": "error" } };
Disallow synchronous tests
This rule disallows synchronous tests, encouraging the use of asynchronous tests to avoid blocking the event loop.
module.exports = { "rules": { "mocha/no-synchronous-tests": "error" } };
Limit the number of top-level suites
This rule limits the number of top-level suites in a test file, promoting better organization and structure of tests.
module.exports = { "rules": { "mocha/max-top-level-suites": ["error", { "limit": 1 }] } };
eslint-plugin-jest is an ESLint plugin for Jest, another popular JavaScript testing framework. It provides similar linting rules specific to Jest, helping enforce best practices and coding standards for Jest tests. While eslint-plugin-mocha is tailored for Mocha, eslint-plugin-jest is designed for Jest.
eslint-plugin-jasmine is an ESLint plugin for Jasmine, a behavior-driven development framework for testing JavaScript code. It offers linting rules specific to Jasmine, ensuring best practices and consistency in Jasmine tests. Like eslint-plugin-mocha, it focuses on a different testing framework.
eslint-plugin-qunit is an ESLint plugin for QUnit, a powerful, easy-to-use JavaScript unit testing framework. It provides linting rules specific to QUnit, helping maintain best practices and coding standards in QUnit tests. It serves a similar purpose to eslint-plugin-mocha but for QUnit.
ESLint rules for mocha.
This plugin requires ESLint 1.4.1
or later.
npm install --save-dev eslint-plugin-mocha
Then add a reference to this plugin and selected rules in your eslint config:
{
"plugins": [
"mocha"
],
"rules": {
"mocha/no-exclusive-tests": 2
}
}
See Configuring Eslint on eslint.org for more info.
The documentation of the rules can be found here.
If you are not using mocha you should not use this plugin.
1.1.0 (November 13, 2015)
FAQs
Eslint rules for mocha.
The npm package eslint-plugin-mocha receives a total of 455,884 weekly downloads. As such, eslint-plugin-mocha popularity was classified as popular.
We found that eslint-plugin-mocha demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.